#include "workerthread.h"
#include <QDebug>

int WorkerThread::packageCount = 200;
void WorkerThread::run(){
    qDebug() << QStringLiteral("准备开始ID = ")
             << QThread::currentThread();
    int count  = 0;
    while (packageCount > 0) {
         mutex.lock();
        qDebug() << QStringLiteral("员工号：")
                 << QThread::currentThread()
                 << QStringLiteral("抢到礼品盒编号:")
                 << packageCount;
        --packageCount;
        ++count;
        mutex.unlock();
        QThread::msleep(1);//休息1ms
    }
     qDebug()<<  QStringLiteral("员工号：")
              << QThread::currentThread()
              << QStringLiteral("总共抢到礼品盒个数为：")
              << count;
}


WorkerThread::WorkerThread()
{

}
